<? 
header("Cache-Control: max-age=3600, must-revalidate");
require('includes/class.main.php');
$manager = new MeetingManager();
$lookup = new MeetingLookup();
$row = $_GET['row'];

$location = $lookup->getAddressByRow($row);
$meeting = $lookup->getMeetingNameByRow($row);
$information = $lookup->getAllByRow($row);
?>
<? include('template/map-header.php'); ?>
<div
	id="map_canvas"
	style="width: 500px; height: 300px; float: left; margin-right: 10px;"></div>

<div id="information">
	<?
	while ($row = $information->fetch_row()) {
		echo "<b>$row[1]</b><br>\n";

		if ($row[2] != "") {
			echo "$row[2]<br>";
		}

		echo "$row[3]<br>";

		if ($row[4] != "") {
			echo "$row[4]<br>\n";
		}

		echo "$row[6], GA $row[7]<br>\n";

		if ($row[5] != "") {
	  echo "<br><b>Location Notes: </b> $row[5]";
		}

		if ($row[12] != "") {
	  echo "<br><b>Group Notes: </b> $row[12]";
		}

		$index = $row[0];
		$to = "$row[3], $row[6], GA $row[7]";
	}
	?>

	<? 
		$user_address = isset($_SESSION['user_address']) ? $_SESSION['user_address'] : "";
		$user_city = isset($_SESSION['user_city']) ? $_SESSION['user_city'] : "";
		$user_state = isset($_SESSION['user_state']) ? $_SESSION['user_state'] : "";
		$user_zip = isset($_SESSION['user_zip']) ? $_SESSION['user_zip'] : "";
	?>
	<br> <br> <b>Driving Directions:</b><br>
	<form method="POST" action="directions.php">
		<table>
			<tr>
				<td>Address:</td>
				<td><input type=text name=user_address
					value="<? echo $user_address; ?>"></td>
			</tr>
			<tr>
				<td>City:</td>
				<td><input type=text name=user_city
					value="<? echo $user_city; ?>"></td>
			</tr>
			<tr>
				<td>State:</td>
				<td><input type=text name=user_state
					value="<? echo $user_state; ?>"></td>
			</tr>
			<tr>
				<td>Zip:</td>
				<td><input type=text name=user_zip
					value="<? echo $user_zip; ?>"></td>
			</tr>

			<?
  
			if ((isset($_SESSION['remember'])) && ($_SESSION['remember'] == "on")) {
				echo "<tr><td colspan=2><input type=checkbox name=forget>Forget my address!</td></tr>\n";
			} else {
				echo "<tr><td colspan=2><input type=checkbox name=remember>Remember my address!</td></tr>\n";
			}
			?>

		</table>
		<input type="hidden" name="row" value="<? echo $index; ?>"> <input
			type="hidden" name="to" value="<? echo $to; ?>"> <input type="submit"
			name="directions" value="Get Directions">
	</form>
</div>

<br>
<br>

<? include('template/footer.php'); ?>
